//
//  ViewController.swift
//  SwiftLoopers
//
//  Created by MAC on 2017/8/21.
//  Copyright © 2017年 Kevin. All rights reserved.
//

import UIKit

//import Home
//import Search
//import Order
//import Mine


class ViewController: UITabBarController {

    
    override func viewDidLoad() {
        super.viewDidLoad()
        setupViewControllers()
        
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    func setupViewControllers() {
        let home = Home()
        let search = Search()
        let order = Order()
        let mine = Mine()
        self.addChildViewController(childController: home, imageName: "icon_tabbar_homepage",title:"首页")
        self.addChildViewController(childController: search, imageName: "icon_tabbar_onsite",title:"搜索")
        self.addChildViewController(childController: order, imageName: "icon_tabbar_merchant_normal",title:"订单")
        self.addChildViewController(childController: mine, imageName: "icon_tabbar_mine",title:"我的")
        
    }
    
    func addChildViewController(childController: UIViewController, imageName:String, title:String)  {

        tabBar.tintColor = UIColor.init(red: 108/255.0, green: 184/255.0, blue: 127/255.0, alpha: 1)
        
        
        childController.tabBarItem.title = title
        childController.tabBarItem.image = UIImage.init(named: imageName)

        let nav = BaseNavigationController.init(rootViewController: childController)
    
//        nav.addChildViewController(childController)
        
        addChildViewController(nav)
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

